package com.ruoyi.wapp.web.service.processor;

import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.utils.MessageUtils;
import com.ruoyi.wapp.manager.AsyncManager;
import com.ruoyi.wapp.manager.factory.AsyncFactory;
import com.ruoyi.wapp.service.domain.WappUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class DefaultRegisterPostProcessor implements RegisterPostProcessor {
    Logger logger = LoggerFactory.getLogger(DefaultRegisterPostProcessor.class);

    @Override
    public void postProcessBeforeRegister(WappUser user) {
        logger.info(JSON.toJSONString(user));
    }

    @Override
    public void postProcessAfterRegister(boolean regFlag, WappUser user) {
        AsyncManager.me().execute(AsyncFactory.recordLogininfor(user.getUserName(), Constants.REGISTER, MessageUtils.message("user.register.success")));
    }
}
